<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
             margin: 0;
             padding: 0;
        }
        li{
             list-style: none; 
        }
        .subnav li{
            width: 20px;
            height: 20px;
            margin: 3px 0;
            background-color:pink;
            position: relative;
         
        }
        .subnav {
            margin: 100px auto;
            width: 20px;
        }
        .subnav div{
            position: absolute;
            right: 0;
            top: 0;
            height: 20px;
            width: 0;
            background-color: purple;
            transition: all .4s;
            z-index: -1;
        }
        .subnav li:hover div{
            width:100px;
        }
    </style>
</head>
<body>
    <div class="subnav">
        <ul>
            <li>
                <div></div>
            </li>
            <li>
                <div></div>
            </li>
            <li>
                <div></div>
            </li>
            <li>
                <div></div>
            </li>
            <li>
                <div></div>
            </li>
            <li>
                <div></div>
            </li>
        </ul>
    </div>
</body>
</html>